function gewTestNode()
{ 
  gewNode.call(this);
  this.mesh = null;  
}
gewTestNode.prototype = new gewNode();

gewTestNode.prototype.setMesh = function(mesh)
{
  this.mesh = mesh;
  this.localAabb = mesh.aabb;
  this.localSphere = mesh.boundingSphere;
  this.updateWorldAabb();
  this.updateWorldSphere();
  
}
gewTestNode.prototype.getMesh = function()
{
  return this.mesh;
}

gewTestNode.prototype.render = function(material)
{
  var m = this.mesh; 
  if(m&&m.isReady)
  {  
    var gl = this.gl;
    if(m.meshType==STATIC_MESH)
    {
      if(material.name=="PhongMaterial")
      {
        var effect = material.effect;
        //Set up vertex att pointers
        gl.bindBuffer(gl.ARRAY_BUFFER, m.glBuffers.positions);
        gl.vertexAttribPointer(effect.inPosition, 3, gl.FLOAT, false, 0, 0);
        gl.bindBuffer(gl.ARRAY_BUFFER, m.glBuffers.texcoords);
        gl.vertexAttribPointer(effect.inTexCoord0, 2, gl.FLOAT, false, 0, 0);
        gl.bindBuffer(gl.ARRAY_BUFFER, m.glBuffers.normals);
        gl.vertexAttribPointer(effect.inNormal, 3, gl.FLOAT, false, 0, 0); 
      }
      else if(material.name=="CSMMaterial")
      {
        var effect = material.effect;
        //Set up vertex att pointers
        gl.bindBuffer(gl.ARRAY_BUFFER, m.glBuffers.positions);
        gl.vertexAttribPointer(effect.inPosition, 3, gl.FLOAT, false, 0, 0);
      }
      if (m.renderType == TRIANGLES_NON_INDICES) 
      {
        // Do the draw, as triangles
        var ver_num = m.vertices.length / 3;
        gl.drawArrays(gl.TRIANGLES, 0, ver_num);
      }
      else if(m.renderType==TRIANGLES_INDICES)
      {
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, m.glBuffers.indices[0]);
        gl.drawElements(gl.TRIANGLES,m.indices[0].length,gl.UNSIGNED_SHORT,0);
      }
    }
    else if(m.meshType==KEYFRAME_MESH)
    {
      var effect = material.effect;
      if(material.name=="PhongKFMaterial")
      {
        //Set up vertex att pointers
        if( m.animations.walk.properties[4]<0.8)
          m.animations.walk.properties[4]= m.animations.walk.properties[4]+0.001;
        else
          m.animations.walk.properties[4] = 0.;
        gl.uniform1fv(effect.properties,m.animations.walk.properties);
        var glBuffers = m.glBuffers;
        for (var i = 0; i < 5; i++) 
        {
          if (i < glBuffers.positionsArray.length) 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.positionsArray[i]);
            gl.vertexAttribPointer(effect.inPosition[i], 3, gl.FLOAT, false, 0, 0);
          } else 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.positionsArray[0]);
            gl.vertexAttribPointer(effect.inPosition[i], 3, gl.FLOAT, false, 0, 0);
          }
          if (i < glBuffers.normalsArray.length) 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.normalsArray[i]);
            gl.vertexAttribPointer(effect.inNormal[i], 3, gl.FLOAT, false, 0, 0);
          } else 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.normalsArray[0]);
            gl.vertexAttribPointer(effect.inNormal[i], 3, gl.FLOAT, false, 0, 0);
          }
          if (i < glBuffers.texcoordsArray.length) 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.texcoordsArray[i]);
            gl.vertexAttribPointer(effect.inTexCoord0[i], 2, gl.FLOAT, false, 0, 0);
          } else 
          {
            gl.bindBuffer(gl.ARRAY_BUFFER, glBuffers.texcoordsArray[0]);
            gl.vertexAttribPointer(effect.inTexCoord0[i], 2, gl.FLOAT, false, 0, 0);
          }
        }
      }
      else if(material.name=="CSMMaterial")
      {
        /*
         //Set up vertex att pointers
         gl.bindBuffer(gl.ARRAY_BUFFER, m.glBuffers.positionsArray[0]);
         gl.vertexAttribPointer(effect.inPosition, 3, gl.FLOAT, false, 0, 0);
         */
      }
      if (m.renderType == TRIANGLES_NON_INDICES) 
      {
        // Do the draw, as triangles
        var ver_num = m.verticesArray[0].length / 3;
        gl.drawArrays(gl.TRIANGLES, 0, ver_num);
      }
      else if(m.renderType==TRIANGLES_INDICES)
      {
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, m.glBuffers.indices[0]);
        gl.drawElements(gl.TRIANGLES,m.indices[0].length,gl.UNSIGNED_SHORT,0);
      }
    }
  }
}

